<import Name="Button" src="Button.tpl" />
<import Name="Menu" src="Menu.tpl" />
<DockPanel Id="Root" >
  <Rectange Height="25" Color="#000000"  Pivot="TopLeft" Dock="TopLeft">
   <StackPanel  Orientation="Horizontal">
     <Text Id="Text0" Text="文件" Position="0,-3,0" Color="#ffffff" Pivot="TopLeft" margin="20 -4 10 0" OnMouseDown="js:OnMenuClick2(0,'FileMenu')" />
     <Text Id="Text1" Text="编辑" Position="0,-3,0" Color="#ffffff" Pivot="TopLeft"  margin="10 -4 10 0" />
     <Text Id="Text2" Text="窗口" Position="0,-3,0" Color="#ffffff" Pivot="TopLeft" margin="10 -4 10 0" />
     <Text Id="Text3" Text="帮助" Position="0,-3,0" Color="#ffffff" Pivot="TopLeft" margin="10 -4 10 0" />
     <Text Id="Text4" Text="关于" Position="0,-3,0" Color="#ffffff" Pivot="TopLeft" margin="10 -4 10 0" OnMouseDown="js:OnMenuClick2(4,'AboutMenu')" />
   </StackPanel>
 </Rectange>

 <Menu Id="FileMenu" MenuNames="$FileMenu$" Active="false" />
 <Menu Id="AboutMenu" MenuNames="$AboutMenu$" Active="false" />

</DockPanel>

<script>
    var CurMenuId = ""
    function OnMenuClick2(ItemID,MenuName)
    {
      CurMenuId = MenuName
      TextPosNode = TopWidget.GetId("Text"+ItemID).Node
      TextPos=TextPosNode.GetWorldPosition()
      CurShowMenu = TopWidget.GetId(MenuName).GetId("Root").Node.SetActive(true)
      TopWidget.GetId(MenuName).Node.SetPosition(TextPos.X+5.0,TextPos.Y - 15.0,TextPos.Z) 
    }
</script>
